package dgut.party.business.mockdata;

import dgut.party.business.dao.org.OrganizationRepository;
import dgut.party.business.entity.org.Organization;

import java.util.ArrayList;
import java.util.List;

public class MockOrgBean {
  public static void initAccounts(OrganizationRepository orgRepo) {
    Organization rootOrg = Organization.builder().name("总党支部").build();
    rootOrg.setSubOrgs(getSecondOrg());
    orgRepo.save(rootOrg);
  }

  public static List<Organization> getSecondOrg() {
    List<Organization> orgs = new ArrayList<>();
    orgs.add(Organization.builder().name("一级党支部1").build());
    orgs.add(Organization.builder().name("一级党支部2").build());
    orgs.add(Organization.builder().name("一级党支部3").build());
    orgs.forEach(org -> org.setSubOrgs(getThirdOrg()));
    return orgs;
  }

  public static List<Organization> getThirdOrg() {
    List<Organization> orgs = new ArrayList<>();
    orgs.add(Organization.builder().name("二级党支部1").build());
    orgs.add(Organization.builder().name("二级党支部2").build());
    orgs.add(Organization.builder().name("二级党支部3").build());
    return orgs;
  }
}
